package lunceneDemo;

import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.FileSystems;
import java.nio.file.Paths;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;

public class CreateIndex {
	public static void main(String[] args) throws IOException, URISyntaxException {
//		File file=new File("D:\\TestLuncene\\file");
//		
//		//Directory directory=FSDirectory.open(Paths.get("D:\\TestLuncene\\index_6.5"));
//		Directory directory=FSDirectory.open(FileSystems.getDefault().getPath("D:\\TestLuncene\\index_6.5"));
//		Analyzer analyzer=new StandardAnalyzer();
//		IndexWriterConfig config=new IndexWriterConfig(analyzer);
//		IndexWriter writer=new IndexWriter(directory, config);
//		
//		File[] listFiles = file.listFiles();
//		Document d=null;
//		for (File file2 : listFiles) {
//			d = new Document();
//			d.add(new TextField("filename", file2.getName(), Field.Store.YES));
//			d.add(new TextField("filepath", file2.getPath(), Field.Store.YES));
//			writer.addDocument(d);
//		}
//		
//		writer.close();
//		
		
		
	}
}
